<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="../lib/vue.js"></script>
</head>
<body>

<div id="box">
    <input type="button" @click="a='aaa'" value="aaa组件"/>
    <input type="button" @click="a='bbb'" value="bbb组件"/>
    <component :is="a"></component>
</div>

<script>

    var vm = new Vue({
        el: '#box',
        data: {
            a: 'aaa'
        },
        components: {
            'aaa': {
                template: '<h2>我是aaa组件</h2>'
            },
            'bbb': {
                template: '<h2>我是bbb组件</h2>'
            }
        }

    })
</script>
</body>
</html>